package com.aisun.flinkservice.tomessage;

import com.alibaba.fastjson.JSONObject;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;

import java.util.Date;

/**
 * @Author: LiuYuanQi
 * @Date: 2020/4/29 16:11
 */
public class MessageSplitter implements FlatMapFunction<String, Tuple2<String, Long>>{

    @Override
    public void flatMap(String value, Collector<Tuple2<String, Long>> out) throws Exception {
//        if (value != null && value.contains(",")) {
//            String[] parts = value.split(",");
//            out.collect(new Tuple2<>(parts[1], Long.parseLong(parts[2])));
//        }
        out.collect(new Tuple2<>(value, new Date().getTime()));
    }

}
